.title_wrapper
  %h2 View Application Account

%h3
  = h @application_accounts.name
  
.detail_view

  %h4
    View Details
  %p
    %b
      Name:
    = h @application_accounts.name
  %p
    %b
      Api key: (Please keep secure this key.)
    = h @application_accounts.api_key
    = link_to 'Generate New API KEY', {:action => :regenerate_apikey, :id => @application_accounts}, :confirm => 'Would you like to generate new API Key?'
  %p
    %b
      Distributor:
    = h @application_accounts.distributor.name
  %p
    %b
      Description:
    = h @application_accounts.description
  %p
    %b
      Url:
    = h @application_accounts.url
  %p
    %b
      Status:
    = h @application_accounts.status
  %p
    %b
      Created at:
    = h @application_accounts.created_at.strftime("%b. %d, %Y %H:%M")
  %p
    %b
      Updated at:
    = h @application_accounts.updated_at.strftime("%b. %d, %Y %H:%M")
    
  %br
  %br
.title_wrapper
  %h2
    Bundle Variations
.table_view
  %table
    %tr
      %th
        Bundle
      %th
        Description
      %th
        Frequency
      %th
        Price
      %th
        Trial Period
      %th
        Need Credit Card
      %th
        Status
      - @application_accounts.bundle_variations.each do |b|
        %tr
          %td
            = h (b.bundle.id.to_s + " " + b.bundle.name)
          %td
            = h b.bundle.description
          %td
            = h b.frequency
          %td
            = h number_to_currency_with_cents(b.price)
          %td
            = h (b.trial_period.nil? ? "" : pluralize(b.trial_period.period, b.trial_period.frequency))
          %td
            = h (b.trial_period.nil? ? "" : b.trial_period.need_credit_card)
          %td
            = h b.status
  
= link_to 'Edit', edit_application_account_path(@application_accounts)
|
= link_to 'Back', application_accounts_path
